package com.http.form;

import com.wap.framework.util.Constants;

public class FormHelper {
	
	private static FormHelper instance = new FormHelper();
	
	public static FormHelper getInstance() {
        return instance;
    }
	/**
	 * 重载某个广告
	 * @param adid
	 */
	public String reloadAdByAdid(String adid){
		String wapsitePath = Constants.WAPSITE_PATH;
		Form form = new Form();
		form.setAction(wapsitePath+"/update_cache.jsp");
		form.pushNameValuePair("cmd", "reloadAdByAdid");
		form.pushNameValuePair("adid", adid);
		form.sendAsGetMethod();
		return form.getResponseBody();
	}
	
	/**
	 * 更新某个页面内容
	 * @param pageId
	 */
	public String updatePageObjectById(String pageId){
		String wapsitePath = Constants.WAPSITE_PATH;
		Form form = new Form();
		form.setTimeout(2);
		form.setAction(wapsitePath+"/update_cache.jsp");
		form.pushNameValuePair("cmd", "updatePageObjectById");
		form.pushNameValuePair("pageid", pageId);
		form.sendAsGetMethod();
		return form.getResponseBody();
	}
	
	/**
	 * 重载全部广告
	 */
	public String reloadAdversion(){
		String wapsitePath = Constants.WAPSITE_PATH;
		Form form = new Form();
		form.setAction(wapsitePath+"/update_cache.jsp");
		form.pushNameValuePair("cmd","reloadAdversion");
		form.sendAsGetMethod();
		return form.getResponseBody();
	}
	
	/**
	 * 保存全部PV
	 */
	public String saveAllPVData(){
		String wapsitePath = Constants.WAPSITE_PATH;
		Form form = new Form();
		form.setAction(wapsitePath+"/update_cache.jsp");
		form.pushNameValuePair("cmd", "saveallpv");
		form.sendAsGetMethod();
		return form.getResponseBody();
	}

}
